package com.mjk.common.core.jdbc.service.idgenerator;

import com.mjk.common.core.jdbc.service.idgenerator.impl.DateSeqGeneratorImpl;
import com.mjk.common.core.jdbc.service.idgenerator.impl.IncrGenerateImpl;
import com.mjk.common.core.jdbc.service.idgenerator.impl.SnowFlakeGeneratorImpl;
import com.mjk.common.core.jdbc.service.idgenerator.impl.UUIDGenerateImpl;

/**
 * 主键生成策略
 */
public enum IdGenerateType {
    AUTO_INCR(new IncrGenerateImpl()),//自增
    AUTO_UUID(new UUIDGenerateImpl()),//UUID算法
    AUTO_SNOWFLAKE(new SnowFlakeGeneratorImpl()),//雪花算法
    AUTO_DATE_SEQ(new DateSeqGeneratorImpl());//时间YYYYMMDHHMMSS+自增序列

    private IdGenerator generator;

    IdGenerateType(IdGenerator generator) {
        this.generator = generator;
    }

    public IdGenerator getGenerator() {
        return this.generator;
    }
}